package com.shaiMiMi;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class NewMMActivity extends Activity {

	private EditText 	mEditText = null;
	private Button 		mSubmitbButton = null;
	private ZTcpSocketThread mTcpThread = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.new_mm_activity);

		mSubmitbButton = (Button)this.findViewById(R.id.submit);
		mEditText = (EditText)this.findViewById(R.id.newMMEditText);

		mSubmitbButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				String sMMStr = mEditText.getText().toString();
				if (sMMStr.length() > 0) {
					ZPackage_Str strPack = new ZPackage_Str();
					strPack.SetStr(sMMStr);
					mTcpThread.AppendPack(strPack);
				}
			}
		});

		mTcpThread = ConnectInfo.GetInstance().GetTcpSocketThread();
		ConnectInfo.GetInstance().InitTestServerContain();
		ConnectInfo.GetInstance().SendPack4TestServerContain(new ZPackage_Str("hello world!"));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.new_mm, menu);
		return true;
	}

}
